Q: How can I make my process take less CPU time under certain circumstances?
XstSleep(msec) causes a process to yield to other processes for a specified number of milliseconds.  As a convenience, msec = 0 tells the process to yield the rest of its time slice, and be actived again the next time it is it's turn.

Note that Windows and some versions of UNIX automatically give the process that created the selected window a higher priority than all others.  Many XBasic programs run visibly slower when none of its windows are selected.

One way to conditionally lower the priority of an XBasic process follows:

'
' message processing loop at bottom of Entry()
'
DO
XuiProcessMessages (1)
IF condition THEN XstSleep (msec) ' add this line
LOOP UNTIL terminateProgram
END FUNCTION

Q: An "autosave" feature would be valuable in the event of crashes.
When crashes occur the PDE saves the current application code as file xb.sav.  Only rarely is the PDE unable to save the current application.  Look for xb.sav !!!

Q: When a fatal runtime error occurs, can I change a value and continue running?
Yes.  You can change the values of variables and/or change where the program will continue executing.  Consider the divide by zero and segment violation errors in the following function as examples.

'
' ######################
' ##### Entry () #####
' ######################
'
FUNCTION Entry ()
x = 0  
y = 11
z = 0
a = y \ z ' a = 11 divided by 0 - divide by zero error
b = XLONGAT(x) ' b = contents of memory at address 0x00000000 - invalid memory address
PRINT x,y,z,a,b ' print results
END FUNCTION

Execute this entry function to cause a divide by zero runtime error at a = y \ z since z = 0 as set by the previous line. But you can now display the variables window (F8) and make z non-zero and continue program execution.  Alternatively, you can set the text cursor on a later line and select Run Jump to move the execution line past the error line, then continue execution.  The same solutions apply to the following line, which also causes a "fatal" error as written.